angular.module('mvcApp.one-card-about-page-editor', [
    'ngRoute',
    'ngResource'
]).config(['$routeProvider', function ($routeProvider) {
    $routeProvider
        .when('/one-card-about-page-editor', {
            templateUrl: 'static/views/one-card-about-page-editor.html',
            controller: 'OneCardAboutPageEditorCtrl'
        });
}]).controller('OneCardAboutPageEditorCtrl', ['$scope', '$http', 'Category', 'Shop', 'Product', 'User',
    function ($scope, $http, Category, Shop, Product, User) {
        $scope.one_card_about_page_content = ''; // 一卡通介绍静态页面的内容
        User.getConfig('one_card_about_page_content')
            .then(function (content) {
                $scope.one_card_about_page_content = content;
                $scope.$applyAsync();
            }).catch(function (err) {
                console.log(err);
            });
        $scope.saveConfig = function (key, value) {
            User.setConfig(key, value)
                .then(function () {
                    alert("保存成功");
                }).catch(function (err) {
                    alert(err);
                });
        };
    }]);